import { Tools } from 'weaver-mobile';
import { catchApiError } from '../util/index';
import { PARAMS } from '../components/public/BlogUtils';

// 全部微博
export const getBlogHomepageList = params => {
	let options = {
		method: 'GET',
		url: '/api/blog/base/getBlogHomepageList',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 微博主页--搜索结果列表
export const getBlogHomepageListBySearch = params => {
	let options = {
		method: 'GET',
		url: '/api/blog/base/getBlogHomepageListBySearch',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 微博主页--搜索结果列表
export const getShareToMeList = params => {
	let options = {
		method: 'GET',
		url: '/api/blog/base/getWeiboPageShareToMeList',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

export const getAllBlogList = params => {
	let options = {
		method: 'GET',
		url: '/api/blog/base/getAllWeiboMainPageList',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}


export const setBlogReaded = params => {
	let options = {
		method: 'POST',
		url: '/api/blog/base/setBlogDiscussReaded',
		params: {...PARAMS, ...params}
	};
    return Tools.callApi(options).then(catchApiError);
}

// 未读列表
export const getMyBlogHomepageNew = params => {
	let options = {
		method: 'GET',
		url: '/api/blog/base/getMyBlogHomepageNew',
		params: {...PARAMS, ...params}
	};
    return Tools.callApi(options).then(catchApiError);
}
